Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse postBuild references in the Kustomization #625

Merged
merged 7 commits into from
Apr 20, 2024
Merged

Conversation

allenporter
Copy link
Owner

@allenporter allenporter changed the title Parse postBuild references in the Kustomization w/o substituion Parse postBuild references in the Kustomization Apr 19, 2024
@codecov-commenter
Copy link

codecov-commenter commented Apr 19, 2024

Codecov Report

Attention: Patch coverage is 95.26316% with 9 lines in your changes are missing coverage. Please review.

Project coverage is 93.44%. Comparing base (f17968d) to head (b051f79).

Files Patch % Lines
flux_local/values.py 96.87% 4 Missing ⚠️
flux_local/manifest.py 88.00% 3 Missing ⚠️
flux_local/git_repo.py 94.11% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #625      +/-   ##
==========================================
- Coverage   93.50%   93.44%   -0.06%     
==========================================
  Files          19       20       +1     
  Lines        2001     2120     +119     
==========================================
+ Hits         1871     1981     +110     
- Misses        130      139       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

dd support for expanding postbuild substitions from configmaps/secrets
Add test for unknown substitute reference kind
Repository owner deleted a comment from github-actions bot Apr 20, 2024
Repository owner deleted a comment from github-actions bot Apr 20, 2024
Copy link
Contributor

--- tests/testdata/cluster/clusters/prod Kustomization: flux-system/flux-system Kustomization: flux-system/apps

+++ tests/testdata/cluster/clusters/prod Kustomization: flux-system/flux-system Kustomization: flux-system/apps

@@ -12,12 +12,15 @@

   - name: infra-configs
   interval: 10m0s
   path: ./tests/testdata/cluster/apps/prod
   postBuild:
     substitute:
       cluster_env: production
+    substituteFrom:
+    - kind: ConfigMap
+      name: cluster-config
   prune: true
   sourceRef:
     kind: GitRepository
     name: flux-system
   timeout: 5m0s
   wait: true
--- tests/testdata/cluster/clusters/prod Kustomization: flux-system/flux-system ConfigMap: flux-system/cluster-config

+++ tests/testdata/cluster/clusters/prod Kustomization: flux-system/flux-system ConfigMap: flux-system/cluster-config

@@ -0,0 +1,12 @@

+---
+apiVersion: v1
+data:
+  cluster_label: example-value
+kind: ConfigMap
+metadata:
+  labels:
+    kustomize.toolkit.fluxcd.io/name: flux-system
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: cluster-config
+  namespace: flux-system
+
--- tests/testdata/cluster/apps/prod Kustomization: flux-system/apps HelmRelease: podinfo/podinfo

+++ tests/testdata/cluster/apps/prod Kustomization: flux-system/apps HelmRelease: podinfo/podinfo

@@ -20,12 +20,14 @@

     remediation:
       retries: 3
   interval: 50m
   releaseName: podinfo
   values:
     ingress:
+      additionalLabels:
+        cluster_label: example-value
       className: nginx
       enabled: true
       hosts:
       - host: podinfo.production
         paths:
         - path: /

Copy link
Contributor

--- tests/testdata/cluster/clusters/prod Kustomization: flux-system/flux-system Kustomization: flux-system/apps

+++ tests/testdata/cluster/clusters/prod Kustomization: flux-system/flux-system Kustomization: flux-system/apps

@@ -12,12 +12,15 @@

   - name: infra-configs
   interval: 10m0s
   path: ./tests/testdata/cluster/apps/prod
   postBuild:
     substitute:
       cluster_env: production
+    substituteFrom:
+    - kind: ConfigMap
+      name: cluster-config
   prune: true
   sourceRef:
     kind: GitRepository
     name: flux-system
   timeout: 5m0s
   wait: true
--- tests/testdata/cluster/clusters/prod Kustomization: flux-system/flux-system ConfigMap: flux-system/cluster-config

+++ tests/testdata/cluster/clusters/prod Kustomization: flux-system/flux-system ConfigMap: flux-system/cluster-config

@@ -0,0 +1,12 @@

+---
+apiVersion: v1
+data:
+  cluster_label: example-value
+kind: ConfigMap
+metadata:
+  labels:
+    kustomize.toolkit.fluxcd.io/name: flux-system
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: cluster-config
+  namespace: flux-system
+
--- tests/testdata/cluster/apps/prod Kustomization: flux-system/apps HelmRelease: podinfo/podinfo

+++ tests/testdata/cluster/apps/prod Kustomization: flux-system/apps HelmRelease: podinfo/podinfo

@@ -20,12 +20,14 @@

     remediation:
       retries: 3
   interval: 50m
   releaseName: podinfo
   values:
     ingress:
+      additionalLabels:
+        cluster_label: example-value
       className: nginx
       enabled: true
       hosts:
       - host: podinfo.production
         paths:
         - path: /

@allenporter allenporter merged commit 4d83af7 into main Apr 20, 2024
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants